package com.ruoyi.zsyh.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.zsyh.mapper.ZsyhAfterFactoryAddressMapper;
import com.ruoyi.zsyh.domain.ZsyhAfterFactoryAddress;
import com.ruoyi.zsyh.service.IZsyhAfterFactoryAddressService;
import com.ruoyi.common.core.text.Convert;

/**
 * 售后厂家收货地址Service业务层处理
 * 
 * @author yuexl
 * @date 2023-06-29
 */
@Service
public class ZsyhAfterFactoryAddressServiceImpl implements IZsyhAfterFactoryAddressService 
{
    @Autowired
    private ZsyhAfterFactoryAddressMapper zsyhAfterFactoryAddressMapper;

    /**
     * 查询售后厂家收货地址
     * 
     * @param id 售后厂家收货地址ID
     * @return 售后厂家收货地址
     */
    @Override
    public ZsyhAfterFactoryAddress selectZsyhAfterFactoryAddressById(String id)
    {
        return zsyhAfterFactoryAddressMapper.selectZsyhAfterFactoryAddressById(id);
    }

    /**
     * 查询售后厂家收货地址列表
     * 
     * @param zsyhAfterFactoryAddress 售后厂家收货地址
     * @return 售后厂家收货地址
     */
    @Override
    public List<ZsyhAfterFactoryAddress> selectZsyhAfterFactoryAddressList(ZsyhAfterFactoryAddress zsyhAfterFactoryAddress)
    {
        return zsyhAfterFactoryAddressMapper.selectZsyhAfterFactoryAddressList(zsyhAfterFactoryAddress);
    }

    /**
     * 新增售后厂家收货地址
     * 
     * @param zsyhAfterFactoryAddress 售后厂家收货地址
     * @return 结果
     */
    @Override
    public int insertZsyhAfterFactoryAddress(ZsyhAfterFactoryAddress zsyhAfterFactoryAddress)
    {
        zsyhAfterFactoryAddress.setCreateTime(DateUtils.getNowDate());
        return zsyhAfterFactoryAddressMapper.insertZsyhAfterFactoryAddress(zsyhAfterFactoryAddress);
    }

    /**
     * 修改售后厂家收货地址
     * 
     * @param zsyhAfterFactoryAddress 售后厂家收货地址
     * @return 结果
     */
    @Override
    public int updateZsyhAfterFactoryAddress(ZsyhAfterFactoryAddress zsyhAfterFactoryAddress)
    {
        zsyhAfterFactoryAddress.setUpdateTime(DateUtils.getNowDate());
        return zsyhAfterFactoryAddressMapper.updateZsyhAfterFactoryAddress(zsyhAfterFactoryAddress);
    }

    /**
     * 删除售后厂家收货地址对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteZsyhAfterFactoryAddressByIds(String ids)
    {
        return zsyhAfterFactoryAddressMapper.deleteZsyhAfterFactoryAddressByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除售后厂家收货地址信息
     * 
     * @param id 售后厂家收货地址ID
     * @return 结果
     */
    @Override
    public int deleteZsyhAfterFactoryAddressById(String id)
    {
        return zsyhAfterFactoryAddressMapper.deleteZsyhAfterFactoryAddressById(id);
    }

    public int updateSetDefaultFactoryAddress(String factoryId, String id){
        return zsyhAfterFactoryAddressMapper.updateSetDefaultFactoryAddress(factoryId, id);
    }
}
